package main

import (
	"fmt"
	"jaegerDemo/rabbitmq/demo/vender"
)

func main() {
	rb := vender.Rabbitmq{
		Address:    "amqp://guest:123456@localhost:5672/",
		QueueName:  "rabbitmq_demo",
		MaxRetry:   3,
		MaxConsume: 3,
	}
	if err := rb.InitRabbitmq(); err != nil {
		panic(err)
	}
	defer rb.Close()
	if err := rb.DefaultQueue(); err != nil {
		panic(err)
	}
	// 自己消费
	// 开多个消费者
	if err := rb.DefaultConsumer(func(info []byte) error {
		fmt.Printf("我消费了:%s\n", info)
		return nil
	}); err != nil {
		panic(err)
	}
}
